<template>
    <fieldset>
        <legend><h2>页面二</h2></legend>
        <!--        <h3>{{count}}</h3>-->
        <ul>
            <li v-for="(item, i) in stuScore" :key="i">
                <span>{{item.stuName}}</span><span>-----------------------</span>
                <span>{{item.score}}</span>
            </li>
        </ul>
        <h1>及格学生</h1>
        <ul>
            <li v-for="(item, i) in JGScore" :key="i">
                <span>{{item.stuName}}</span><span>-----------------------</span>
                <span>{{item.score}}</span>
            </li>

        </ul>
        <button @click="Random">幸运加分</button>
        <h1>90分以上学生</h1>
        <ul>
            <li v-for="(item, i) in verygood" :key="i">
                <span>{{item.stuName}}</span><span>-----------------------</span>
                <span>{{item.score}}</span>
            </li>
        </ul>
    </fieldset>
</template>

<script>
    import {mapGetters, mapMutations, mapState} from "vuex";

    export default {
        name: "Pagetwo",
        computed: {
            // JGScore(){
            //     return  this.$store.state.stuScore.filter(
            //     stu=>{
            //         return stu.score>70
            //     }
            //  )
            // },
            ...mapState({
                count: "count",
                stuScore: "stuScore",

            }),
            //写法一
            // ...mapGetters({
            //     JGScore:"JGScore",
            // })
            //写法二
            ...mapGetters(["JGScore"]),
            verygood(){
                return this.$store.getters.scoreGrand("P")
            }
        },
        methods:{
            ...mapMutations(["Random"])
        }

    }
</script>

<style scoped>

</style>